import { Application } from "egg";
import appManager from "./routes/app";
import auditManager from "./routes/audit";
import logManager from "./routes/log";
import orgManager from "./routes/org";
import packageManager from "./routes/package";
import profileManager from "./routes/profile";
import userManager from "./routes/user";
import versionManager from "./routes/version";
import globalManager from "./routes/global";

export default (app: Application) => {
  globalManager(app);
 /*app.use(async (ctx, next) => {
    if (!ctx.session || !ctx.session.profile) {
      ctx.response.status = 401;
      ctx.body = { success: false, _expired: true, message: "登录超时" };
    } else {
      return next();
    }
  });*/
  appManager(app);
  auditManager(app);
  logManager(app);
  orgManager(app);
  packageManager(app);
  profileManager(app);
  userManager(app);
  versionManager(app);
};
